<template>
  <div>
    <radio-table :tableConfig="tableConfig" :tableData="tableData" @noRadio="noRadio"></radio-table>
  </div>
</template>
<script>
import radioTable from '@/components/radioTable.vue'
// import {APIPRECOMMENDEDCOMBINATIONSLIST} from '@/common/api.js'
export default {
  components: {radioTable},
  data () {
    return {
      totalNumber: Number,
      tableData: [],
      tableConfig: {
        load: false,
        size: 'small', // 表格大小
        style: 'width:100%', // 表格宽度
        align: 'center',
        selection: false,
        border: true,
        config: [
          {name: '选择', id: 'radio', width: '40px'},
          {name: '序号', type: 'index', width: '60px'},
          {id: 'student_title', name: '名称'},
          {id: 'topics_num', name: '题量'},
          {id: 'count', name: '时长'},
          {id: 'summary', name: '简介'}
        ]
      }
    }
  },
  created () {
    this.tableList()
  },
  methods: {
    tableList () {
      // APIPRECOMMENDEDCOMBINATIONSLIST({
      //   type: 2
      // }).then((res) => {
      //   if (res.status === 1) {
      //     this.tableData = res.data.list
      //     this.totalNumber = res.data.totalNumber
      //   } else {
      //     this.$message.error(res.msg)
      //     this.tableData = []
      //     this.tableData.push(this.seacherTab)
      //   }
      // }).catch((err) => {
      //   this.$message.error(err.msg)
      // })
    },
    noRadio (val) {
      var arr = []
      arr.push(val.val)
      this.$emit('haveChosen', arr, this.totalNumber)
    }
  }
}
</script>
